home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIP Haziran 2001.iso / prog / share / 18 / setup.exe / equill.dll / HTML / IE.JS < prev    next >
Text File  |  2001-04-10  |  4KB  |  154 lines

  1.  
  2. //------------------------------------------------------------------------------
  3. // ie.js 
  4. //
  5. // Common javascript functions for all HTML dialogs.
  6. //
  7. //
  8. // Things every dialog must define:
  9. //
  10. //   string urlMoreInfo        URL the moreinfo link should lead to, required if the link exists
  11. //
  12. //
  13. //
  14. //------------------------------------------------------------------------------
  15.  
  16. //------------------------------------------------------------------------------
  17. // Initializations
  18. //------------------------------------------------------------------------------
  19.  
  20. // Disable the right click context menu
  21. document.oncontextmenu = function(){return false}
  22.  
  23.  
  24. //------------------------------------------------------------------------------
  25. // Constants
  26. //------------------------------------------------------------------------------
  27.  
  28. // These must all match the constants in DialogDefs.h
  29.  
  30. // Dialog type constants
  31. kDialogTypeOK = 0;
  32. kDialogTypeOKCancel = 1;
  33. kDialogTypeYesNo = 2;
  34. kDialogTypeCancel = 3;
  35. kDialogTypeOKShow = 4;
  36. kDialogTypeNone = 5;
  37.  
  38. // Dialog results
  39. kResultFalse = 0;
  40. kResultTrue = 1;
  41. kResultCancel = 2;
  42. kResultSpecial = 3;
  43.  
  44. // Check box types
  45. kDontShowDontAskAgain = 0
  46. kShowDontAskAgain = 1
  47. kShowDontShowMoreTips = 2
  48.  
  49.  
  50. //------------------------------------------------------------------------------
  51. // Default dialog functions
  52. //------------------------------------------------------------------------------
  53.  
  54.  
  55. // Initialize the dialog
  56. function DlgInit()
  57. {
  58.     w = window.external.GetWidth();
  59.     document.all.dialogbox.width = w;
  60.     h = document.all.dialogbox.offsetHeight;
  61.     window.external.SetDimensions(w,h);
  62.  
  63.     document.body.focus();
  64. }
  65.  
  66.  
  67. // Get a dialog parameter
  68. function DlgParam(num)
  69. {
  70.     return window.external.GetNthParam(num);
  71. }
  72.  
  73.  
  74. // End the dialog 
  75. function DlgEnd() 
  76. {     
  77.     window.external.End(true);
  78. }
  79.  
  80.  
  81. // Cancel the dialog
  82. function DlgCancel() 
  83. {     
  84.     window.external.SetResult(0, kResultCancel);    // result 0 is ALWAYS the dialog result
  85.     DlgEnd();
  86. }
  87.  
  88.  
  89. // OK the dialog
  90. function DlgOK() 
  91. {     
  92.     window.external.SetResult(0, kResultTrue);    // result 0 is ALWAYS the dialog result
  93.     if( window.event ) //it's possible to have swallowed the event already (by calling DlgLinkTo, for example)
  94.         window.event.cancelBubble = true;
  95.     DlgEnd();
  96. }
  97.  
  98.  
  99. // End the dialog with a "special" result
  100. function DlgSpecial() 
  101. {     
  102.     window.external.SetResult(0, kResultSpecial);    // result 0 is ALWAYS the dialog result
  103.     if( window.event ) //it's possible to have swallowed the event already (by calling DlgLinkTo, for example)
  104.         window.event.cancelBubble = true;
  105.     DlgEnd();
  106. }
  107.  
  108.  
  109.  
  110. // Handle a mouse down event in the dialog window
  111. function DlgMouseDown()
  112. {
  113.     var cancel = true;
  114.  
  115.     var srcElement = window.event.srcElement;
  116.     if (srcElement != null) {
  117.         var tag = srcElement.tagName;
  118.         var type = srcElement.type;
  119.  
  120.         if (tag != null) {
  121.             tag = tag.toLowerCase();
  122.             if (tag == "textarea") {
  123.                 cancel = false;
  124.             } else if (tag == "input" && type != null) {
  125.                 type = type.toLowerCase();
  126.                 if (type == "text" || type == "password")
  127.                     cancel = false;
  128.             }
  129.         }
  130.     }
  131.  
  132.     if (cancel) {
  133.         document.selection.empty();
  134.         window.event.cancelBubble = true;
  135.     }
  136.     return true;
  137. }
  138.  
  139.  
  140. // Give more info on the dialog
  141. function DlgMoreInfo()
  142. {
  143.     if (urlMoreInfo != null)
  144.         window.external.OnHelp(urlMoreInfo);
  145. }
  146.  
  147.  
  148. // Open to a new URL
  149. function DlgLinkTo( URL ){
  150.     window.external.OnHelp( URL );
  151.     //window.open( URL );
  152. }
  153.  
  154.